package ro.bluecube.admlocal.users.entity;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQuery;
import javax.persistence.Table;

import ro.bluecube.admlocal.commons.PersistableEntity;
import ro.bluecube.admlocal.persons.entity.Person;

/**
 * @author anton
 *
 */
@Entity
@Table(name="users")
@NamedQuery(name="findAllUsers", query="SELECT u FROM User u")
public class User extends PersistableEntity{

	private static final long serialVersionUID = -3933747942807543497L;
	
	private String userName;
	private String password;
	
	private Person person;
	
	public void setUserName(String userName) {
		this.userName = userName;
	}

	public String getUserName() {
		return userName;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	public String getPassword() {
		return password;
	}

	public void setPerson(Person person) {
		this.person = person;
	}

	@ManyToOne(cascade={CascadeType.ALL})
	public Person getPerson() {
		return person;
	}
}